<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>企业明细</title>
    <link rel="stylesheet" type="text/css" href="easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
    <script src="js/jquery-1.4.4.min.js"></script>
    <script src="easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="easyui/datagrid-dnd.js"></script>
</head>

<body class="easyui-layout">
	<div data-options="region:'west',split:true,title:'企业库',collapsed:true" style="width:46%;">
    
    	<div id="companylibtb" style="padding:5px;height:auto">
            <input class="easyui-searchbox" data-options="prompt:'请输入查询条件',menu:'#searcheTool',searcher:doSearch" style="width:200px"></input>
            <div id="searcheTool">
                <div data-options="name:'企业名称'">企业名称</div>
                <div data-options="name:'GUID',iconCls:'icon-ok'">GUID</div>
                <div data-options="name:'标签名'">标签名</div>
            </div>
            <a href="javascript:;" onClick="addcompany();" class="easyui-linkbutton" iconCls="icon-add" plain="true">新增</a>
        </div>
        <table id="companylib"></table>
    
    </div>
    <div id="log" data-options="region:'south',title:'操作日志',collapsed:true" style="height:80px;">1</div>
	<div data-options="region:'center',title:'当前标签所包含的企业'">
    
        <div id="detailTabtb" style="padding:5px;height:auto">
            <input class="easyui-searchbox" data-options="prompt:'请输入查询条件',menu:'#searcheTool',searcher:doSearch" style="width:200px"></input>
            <div id="searcheTool">
                <div data-options="name:'企业名称'">企业名称</div>
                <div data-options="name:'GUID',iconCls:'icon-ok'">GUID</div>
                <div data-options="name:'标签名'">标签名</div>
            </div>
            <a href="javascript:;" onClick="$('body').layout('expand','west');" class="easyui-linkbutton" iconCls="icon-add" plain="true">新增</a>
            <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a>
        </div>
        <table id="detailTab"></table>
    
    </div>

<script type="text/javascript">
	var dataJson1={"total":20,"rows":[
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司1','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司2','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司3','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司4','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司5','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司6','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司7','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司8','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司9','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司10','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司11','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司12','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司13','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司14','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司15','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司16','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司17','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司18','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司19','labers':'教育','targettable':'lib'},
			{'code':'2176234-72341-392871-dwnsd','name':'新东方教育股份有限公司20','labers':'教育','targettable':'lib'}
		]};
	var dataJson2={"total":20,"rows":[
			{'code':'2176234-72341-392871-dwnsd','name':'昆泰房产1','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'昆泰房产2','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'昆泰房产3','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'昆泰房产4','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'昆泰房产5','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'昆泰房产6','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'珠海朝阳房产7','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'珠海朝阳房产8','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'珠海朝阳房产9','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'珠海朝阳房产10','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'珠海朝阳房产11','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'珠海朝阳房产12','labers':'房产','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'速7快捷酒店13','labers':'住宿业','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'速7快捷酒店14','labers':'住宿业','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'速7快捷酒店15','labers':'住宿业','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'速7快捷酒店16','labers':'住宿业','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'速7快捷酒店17','labers':'住宿业','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'速7快捷酒店18','labers':'住宿业','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'速7快捷酒店19','labers':'住宿业','targettable':'labers'},
			{'code':'2176234-72341-392871-dwnsd','name':'速7快捷酒店20','labers':'住宿业','targettable':'labers'}
		]};
	$(function(){
		$('#detailTab').datagrid({ 
			data:dataJson1,
			toolbar:"#detailTabtb",
			checkbox:true,fitColumns:true,fit:true,pagination:true,ctrlSelect:true,onBeforeDrop:moveMonitor,
			columns:[[ 
				{field:'code',title:'GUID编号',width:100}, 
				{field:'name',title:'企业名称',width:100},
				{field:'labers',title:'标签',width:100,align:'center'}
				]],
			onLoadSuccess:function(){
				$(this).datagrid('enableDnd');
			},
			
		});
		
		$('#companylib').datagrid({ 
			data:dataJson2,
			toolbar:"#companylibtb",
			fitColumns:true,fit:true,pagination:true,ctrlSelect:true,onBeforeDrop:moveMonitor,
			columns:[[
				{field:'checkboxs',title:'GUID编号',checkbox:true},
				{field:'code',title:'GUID编号',width:100},    
				{field:'name',title:'企业名称',width:100},    
				{field:'labers',title:'标签',width:100,align:'center'}    
				]],
			onLoadSuccess:function(){
				$(this).datagrid('enableDnd');
			}
		})  
	})
	
	function doSearch(value,name){
		alert('您查询的条件是: ' + value+'('+name+')');
	}
	
	function addcompany(){
		var data = $("#companylib").datagrid("getSelections");
		$.messager.alert('温馨提示','本标签新增加企业'+data.length+'家\r\n');
		console.debug(data);
	}
	
	function moveMonitor(targetRow,sourceRow,point){
		var myDate = new Date();
		if(targetRow.targettable=='lib' && sourceRow.targettable=='labers'){
			$('#log').prepend(myDate.toLocaleString()+': 新增了一家企业到本标签库，企业名称：'+targetRow.name+'<br/>');
		}
		if(targetRow.targettable=='labers' && sourceRow.targettable=='lib'){
			$('#log').prepend(myDate.toLocaleString()+': 删除了一家企业，企业名称：'+targetRow.name+'<br/>');
		}
	}
</script>
</body>
</html>
